package fei.yuzhi.com.loveflowers.fragment.firstpagefragment.detail;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import fei.yuzhi.com.loveflowers.R;
import fei.yuzhi.com.loveflowers.fragment.firstpagefragment.detail.baseinformation.BaseAll;
import fei.yuzhi.com.loveflowers.fragment.firstpagefragment.detail.baseinformation
        .BaseInformationFragment;
import fei.yuzhi.com.loveflowers.fragment.firstpagefragment.detail.evaluate.EvaluateFragment;
import fei.yuzhi.com.loveflowers.fragment.firstpagefragment.detail.goodsdetail.GoodsDetailFragment;

/**
 * Created by My on 2016/10/8.
 */
public class DetailActivity extends AppCompatActivity {
    private LinearLayout linearLayout;
    private FragmentManager manager;
    private FragmentTransaction transaction;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_detail);
        linearLayout = (LinearLayout) findViewById(R.id.firstpage_detail_fragmentlayout);
        manager = getSupportFragmentManager();
        transaction = manager.beginTransaction();
        transaction.add(R.id.firstpage_detail_fragmentlayout, new BaseAll());
        transaction.commit();

    }

    public void click(View view) {
        switch (view.getId()) {
            case R.id.firstpage_detail_base:
                manager = getSupportFragmentManager();
                transaction = manager.beginTransaction();
                transaction.replace(R.id.firstpage_detail_fragmentlayout, new
                        BaseAll());
                transaction.commit();
                break;
            case R.id.firstpage_detail_goodsdetail:
                manager = getSupportFragmentManager();
                transaction = manager.beginTransaction();
                transaction.replace(R.id.firstpage_detail_fragmentlayout, new GoodsDetailFragment
                        ());
                transaction.commit();
                break;
            case R.id.firstpage_detail_evaluate:
                manager = getSupportFragmentManager();
                transaction = manager.beginTransaction();
                transaction.replace(R.id.firstpage_detail_fragmentlayout, new EvaluateFragment());
                transaction.commit();
                break;
            case R.id.firstpage_detail_back:
                onBackPressed();
                break;
        }
    }
}
